Imports Clo = Enhancements.Core.Logging
Imports Cmp = System.Runtime.CompilerServices
Imports Ere = Enhancements.Basic.RegularExpressions
Imports Iou = System.IO
Imports Ref = System.Reflection
Imports Reg = System.Text.RegularExpressions
Imports Sys = System
Imports Tex = System.Text
Imports Xsd = System.Xml.Schema
Imports W3c = System.Xml

Namespace Enhancements.Basic.Primitives
    ''' <summary>Contains features that add up to the .Net Framework System.Double primitive type.</summary>
    <Serializable(), DebuggerStepThrough()> _
    Public Module [Double]

        ''' <summary>Determines a value's textual representation in Portuguese.</summary>
        ''' <param name="_value">Value to represent.</param>
        ''' <returns> </returns>
        <Cmp.Extension()> _
        Public Function ToPortugueseString(ByVal _value As System.Double) As System.String
            Dim _returnValue As System.String = Sys.String.Empty
            Dim _valueIntegerPart As System.Int64 = CLng(System.Math.Floor(System.Math.Abs(_value)))
            Dim _valueDecimalPart As System.Int64 = 0
            If _value >= 0 Then
                _valueDecimalPart = CType(_value - _valueIntegerPart, Sys.Int64)
            Else
                _valueDecimalPart = CType(System.Math.Abs(_value + _valueIntegerPart), System.Int64)
            End If
            Dim _valueSignal As System.String = String.Empty
            If _value >= 0 Then
                _valueSignal = "+"
            Else
                _valueSignal = "-"
            End If
            _returnValue = Int64.___ToPortugueseString(CType(_valueIntegerPart, Sys.Int64), CType(_valueDecimalPart, Sys.Int64), _valueSignal)

            Return _returnValue
        End Function

    End Module
End Namespace
